package com.daniele.helloworld;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class HelloWorldActivity extends Activity implements OnClickListener{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hello_world);
        final Button button = (Button)findViewById(R.id.button1);
        button.setOnClickListener(this);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.hello_world, menu);
        return true;
    }


	@Override
	public void onClick(View arg0) {
		EditText edit = (EditText) findViewById(R.id.editText1);
		String testo =  edit.getText().toString();
		Bundle bundle = new Bundle();
		bundle.putString("input", testo);
		
		Intent result_intent = new Intent(getApplicationContext(), ResultActivity.class);
		result_intent.putExtras(bundle);
		startActivity(result_intent);
	}
    
}
